$(function() {

    $('#header-nav a').each(function() {
        var href = window.location.href;
        if (href.indexOf(this.href) != -1) {
            $(this).addClass('active').siblings().removeClass('active');
        }
    });

    $('body')
        .on('submit', '#search-form', function() {
            var keyword = $('#search').val();
            if (keyword.trim().length == 0) {
                return false;
            }
            $('#search-form').submit();
        })
        .on('click', '#search-icon', function() {
            var keyword = $('#search').val();
            if (keyword.trim().length == 0) {
                return;
            }
            window.location = baseloaction + '/mobile/class/search?keyword=' + keyword;
        });
});